from panda3d.core import CollisionTraverser,CollisionNode
from panda3d.core import CollisionHandlerQueue,CollisionRay
from panda3d.core import BitMask32
from direct.actor.Actor import Actor

from familiarRelated.abstractFamiliar import AbstractFamiliar

class PandaFamiliar(AbstractFamiliar):
    """ Class representing player's familiar (a summoned creature).
    """
    
    _directObjectParent = None
    _actor = None
    _name = 'Panda'
    
    
        
    def setUpFamiliar(self, playerPos):
        """ Method sets up model and animations for player character.
        """
        
        self._actor =  Actor(
                       "models/panda-model",
                            { "walk":"models/panda-walk4"}
                       )
        
        self._directObjectParent.setPlayerFamiliarActor(self._actor) 
        
        self._actor.reparentTo(render)
        self._actor.setScale(0.0012, 0.0012, 0.0012)
        
        x = playerPos.getX()
        y = playerPos.getY()
        z = playerPos.getZ()
        self._actor.setPos(x + 0.5, y + 0.5, z)
        
#        self.setPos(playerPos)
        
    def moveActor(self):
        """ Method defines what to do when the actor is supposed to move
        (animations management).
        """
        
        self._actor.loop("walk")
        
    def stopActor(self):
        """ Method defines what to do when the actor is supposed to stop
            (animations management)
        """
        
        self._actor.stop()
        self._actor.pose("walk",1)
            
        